package com.qf.servleProject.servlet;

import com.qf.servleProject.entity.Admin;
import com.qf.servleProject.service.AdminService;
import com.qf.servleProject.service.impl.AdminServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/a")
public class AServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

//      通过request作用域做数据的存储 --- 转发方式
//        req.setAttribute("username","gavin");
//        req.getRequestDispatcher("/b").forward(req,resp);

//       重定向 可以使用url拼接传递数据
//        resp.sendRedirect("/WebProject_war_exploded/b");
        resp.sendRedirect("/WebProject_war_exploded/b?username=tom");


    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
